package cloud.seri.auth.service.dto

import io.swagger.annotations.ApiModel
import io.swagger.annotations.ApiModelProperty
import java.io.Serializable
import java.util.*
import javax.validation.constraints.NotNull
import javax.validation.constraints.Size

/**
 * A DTO for the [cloud.seri.auth.domain.Dept] entity.
 */
@ApiModel("Dept")
data class DeptDTO(

    var id: String? = null,

    @get: NotNull
    @get: Size(max = 45)
    @ApiModelProperty("部门名称")
    var title: String? = null,

    @get: Size(max = 45)
    @ApiModelProperty("部门全称")
    var fullName: String? = null,

    @ApiModelProperty("部门排序")
    var sort: Int? = null,

    @ApiModelProperty("部门备注")
    var remark: String? = null,

    @ApiModelProperty("部门状态")
    var status: Int? = null,

    var parentId: String? = null,

    var children: List<DeptDTO> = mutableListOf()

) : Serializable
{

    override fun equals(other: Any?): Boolean
    {
        if (this === other) return true
        if (other !is DeptDTO) return false
        if (other.id == null || id == null) return false

        return Objects.equals(id, other.id)
    }

    override fun hashCode(): Int
    {
        return id.hashCode()
    }
}
